package net.cmkj.mine.common.session;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpSession;

public class SessionContext {
	
	private static Map<String, HttpSession> sessions = new HashMap<String, HttpSession>();
	
	public static synchronized void addSession(HttpSession session) {
        if (session != null) {
        	sessions.put(session.getId(), session);
        }
    }
	
	public static synchronized void delSession(HttpSession session) {
        if (session != null) {
        	sessions.remove(session.getId());
        }
    }
	
	public static synchronized HttpSession getSession(String session_id) {
        if (session_id == null) {
        	return null;
        } else {
        	return sessions.get(session_id);
        }
    }

}
